<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
</body>
</html>
<script>
    var array=new Array(2,3,4,15,9,56,8);
    for(var i=0;i<array.length;++i){
        for(var j=i+1;j<array.length;++j){
            if(array[i]>array[j]){
                var tmp=array[i];
                array[i]=array[j];
                array[j]=tmp;
            }
        }
    }
    alert(array);
</script>